<template>
  <div>
    <!--页头-->
    <page-header></page-header>
    <!--店铺卡片:循环-->
    <restaurant-card v-for="restaurant in restaurantList" :key="restaurant.id" :restaurant="restaurant"></restaurant-card>

    <router-view></router-view>
  </div>
</template>

<script>
  import pageHeader from '../../components/PageHeader';
  import RestaurantCard from '../../components/restaurant/RestaurantCard'
    export default {
      components: {
        pageHeader,
        RestaurantCard
      },
      data() {
        return {
          currentDate: new Date(),
          restaurantList: []
        };
      },
      created() {
        this.$axios({
          method: "get",
          url: "/rest/list"
        })
          .then(response => {
            if (response.data.success) {
              this.restaurantList=response.data.rest_list;
              // return response.data.my_rest_list;
            }
            console.log(response.data.message);

          })
          .catch(error => console.log(error));
      },
      methods: {
        toRestaurantInfo: function () {
          // this.$store.commit('increment');
          // console.log(this.$store.state.count);
          console.log("to Restaurant info from RestaurantList");
          //push to '/restaurant/2234/info'
          this.$router.push({name: 'restaurantInfo', params: {shopId: this.restaurant.shopId}});

        }
      }
    }
</script>

<style scoped>
  .text {
    /**/
    text-align-all: start;
  }

  .time {
    font-size: 13px;
    color: #999;
  }

  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }

  .button {
    padding: 0;
    float: right;
  }

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }
</style>


